-
Notifications
You must be signed in to change notification settings - Fork 583
Add more backing-agnostic methods to Root #17934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: compatible
Are you sure you want to change the base?
Conversation
!ci-bypass-changelog |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I'm curious why can't we use multi-thread for this purpose. Is it that it's hard to design a thread safe API given the legacy code we have?
} ) | ||
|
||
let create_checkpoint_with_directory t ~directory_name = | ||
let backing_type = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: use this aux function defined in this file
let backing_of_t = function
| Stable_db _ ->
Config.Stable_db
| Converting_db _ ->
Converting_db
[empty_hardfork_db]. The accounts are set in the target database in chunks | ||
so the daemon is still responsive during this operation; the daemon would | ||
otherwise stop everything as it hashed every account in the list. *) | ||
let chunked_migration ?(chunk_size = 1 lsl 6) stable_locations_and_accounts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use OCaml threads? Even if we don't have OCaml 5 level of thread support, this is still something?
| Stable_db db -> | ||
let directory_name = | ||
Stable_db.get_directory db | ||
|> Option.value_exn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love having an error messsage
~depth:ledger_depth ~assert_synced:true () | ||
in | ||
L.Root.close converting_root ; | ||
Deferred.unit ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want a check to ensure there's no "long async job" happening? So to keep up with the guarantee "gradual"
It will be helpful for code organization purposes when generating the hard fork config to be able to copy root ledgers (via checkpointing), convert a stable-database-backed root to a converting root, and to (unsafely) view the components of a root ledger.
I've added a test of the
make_converting
method in particular, which converts a stable root to a converting one by migrating the stable database in chunks.These methods were pulled out of #17816; that PR now depends on this one.
Closes: #17751